<!--将上传文件解析为JSON-->
<script setup lang="ts">

const data = defineModel({
  default:""
})
const file = ref<File | null>(null)
watch(file, (newValue:any) => {
  if (newValue) {
    // 从剪映配置文件读取特效，动画等
    console.log('上传的新的数据',newValue)
    const _d=newValue[0]||newValue
    if(!_d ||_d?.length===0) return
    const reader = new FileReader()
    reader.readAsText(_d)
    reader.onload = function () {
      const result = reader.result
      // data.value = JSON.parse(result as string)
      data.value = result as string
      //保存特效数据
    }
  }
})
</script>

<template>
  <v-file-input label="上传工作流文件" v-model="file" variant="underlined"></v-file-input>
</template>

<style scoped lang="scss">

</style>